# Maintainer: David Mott <mott.david.j@gmail.com>
# Contributor: Niklas Holm <jadedcyborg@gmail.com>

pkgname='parallel'
pkgver=20200322
pkgrel='1'
pkgdesc="A shell tool for executing jobs in parallel"
arch=('any')
url='https://www.gnu.org/software/parallel/'
license=('GPL3')
depends=('perl')
source=("https://ftpmirror.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.bz2"{,".sig"}
        "0001-support-MSys2.patch")
validpgpkeys=('CDA01A4208C4F74506107E7BD1AB451688888888')
sha256sums=('207484e124860e215cc3e4d7aff48b3b1c4376c95b3c7c7888453c67e92be94d'
            'SKIP'
            'cf965da42afed45653e937868b667d5e20b785f69ecbb512de50d4aa855aa8a2')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i "${srcdir}/0001-support-MSys2.patch"

  # ACLOCAL_PATH is needed to pick up local m4 macro
  ACLOCAL_PATH="${srcdir}/${pkgname}-${pkgver}" autoreconf -vif
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --build="${CHOST}" \
    --host=${CHOST} \
    --target=${CHOST} \
    --prefix="/usr"
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
